﻿Imports System.Data.SqlClient
Imports System.Data
Partial Class NewCompany
    Inherits System.Web.UI.Page
    Dim conn As New SqlConnection("Data Source=sql.bluetonemedia.com;Initial Catalog=BlueToneMediaDB;Persist Security Info=True;User ID=BTMWiz;Password=esquel4ma@gic")

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        phone.Text = Request.QueryString("num")
    End Sub

    Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
        Dim command As SqlCommand
        Dim queryString As String

        queryString = "INSERT INTO Companys (SiteID, Name, Address, City, State, Zip, Phone, Fax, Website, AccountManager) VALUES (1, @Name, @Address, @City, @State, @Zip, @Phone, @Fax, @Website, 36)"


        command = New SqlCommand(queryString, conn)

        command.Parameters.Add(New SqlParameter("@Name", SqlDbType.NVarChar, 75))
        command.Parameters("@Name").Value = name.Text
        command.Parameters.Add(New SqlParameter("@Address", SqlDbType.NVarChar, 75))
        command.Parameters("@Address").Value = Address.Text
        command.Parameters.Add(New SqlParameter("@City", SqlDbType.NVarChar, 50))
        command.Parameters("@City").Value = city.Text
        command.Parameters.Add(New SqlParameter("@State", SqlDbType.NVarChar, 50))
        command.Parameters("@State").Value = State.Text
        command.Parameters.Add(New SqlParameter("@Zip", SqlDbType.NVarChar, 50))
        command.Parameters("@Zip").Value = zip.Text
        command.Parameters.Add(New SqlParameter("@Phone", SqlDbType.NVarChar, 50))
        command.Parameters("@Phone").Value = phone.Text
        command.Parameters.Add(New SqlParameter("@Fax", SqlDbType.NVarChar, 50))
        command.Parameters("@Fax").Value = Fax.Text
        command.Parameters.Add(New SqlParameter("@Website", SqlDbType.NVarChar, 150))
        command.Parameters("@Website").Value = website.Text


        command.Connection.Open()
        command.ExecuteNonQuery()
        command.Connection.Close()
		
		Response.Redirect("display.htm")
    End Sub
End Class
